package com.hui.account.dialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.Display;
import android.view.Gravity;
import android.view.Window;
import android.view.WindowManager;

import androidx.annotation.NonNull;

import com.hui.account.R;

/**
 * 图片上传按钮选择器
 */
public class CameraDialog extends Dialog {

    public CameraDialog(@NonNull Context context) {
        super(context);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_camera);
    }

    /**
     * 设置 dialog尺寸与屏幕尺寸保持一致
     */
    public void setDialogSize() {
        Window window = getWindow();
        Display display = window.getWindowManager().getDefaultDisplay();

        WindowManager.LayoutParams params = window.getAttributes();
        params.width = display.getWidth();
        params.gravity = Gravity.BOTTOM;
        window.setBackgroundDrawableResource(android.R.color.transparent);
        window.setAttributes(params);
    }
}
